#include <string>

class CMode
{
public:
    CMode() : _idx(0) {}
    //@ret: true: need crrection, false: no correction
    bool Input(const std::string &py);
    //@ret: string to crrect pinyin for the last input
    const std::string &Correct() { return _correct; }
    //@ret: original pinyin
    const std::string &Original() { return _input; }
    //@ret: corrected pinyin
    const std::string &Corrected() { return _corrected_py; }
    void Clear();
    int Disable(const std::string &syll) { return ToggleSyll(syll, false); }
    int Enable(const std::string &syll)  { return ToggleSyll(syll, true); }

private:
    int ToggleSyll(const std::string &syll, bool enable);

private:
    std::string _input; //original pinyin
    std::string _corrected_py; //corrected pinyin
    std::string _correct; //string to crrect pinyin for the last input
    int _idx; //用于标记_input中需要纠正的拼音的起始位置
};
